home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1996 April
/
EnigmA AMIGA RUN 06 (1996)(G.R. Edizioni)(IT)[!][issue 1996-04][Skylink CD V].iso
/
internet
/
others
/
spoolwatch.lha
/
SpoolWatch
/
Src
/
DateDiff.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-09-23
|
2KB
|
65 lines
/*
* Function DateDiff
* Programmer N.d'Alterio
* Date 13/09/95
*
* Synopsis: Returns difference between 2 date stamps in days,
* hours and minutes.
*
* Arguments: dt1 First DateStamp structure.
* dt2 Second DateStamp structure.
* *days To return number of days.
* *hours To return number of hours.
* *mins To return number of minutes.
*
* Returns: None.
*
* Variables: total_minutes1 DateStamp1 converted into minutes
* total minutes2 DateStamp2 converted into minutes
* time_diff Temp variable
*
* $Id: DateDiff.c 1.3 1995/09/23 16:45:49 daltern Exp $
*
*/
#include "SpoolWatch.h"
void DateDiff( struct DateStamp dt1, struct DateStamp dt2,
int *days, int *hours, int *mins )
{
long int total_mins1;
long int total_mins2;
long int time_diff;
/*
* Convert datestamps to minutes before taking difference.
*/
total_mins1 = ( 1440 * dt1.ds_Days ) + dt1.ds_Minute;
total_mins2 = ( 1440 * dt2.ds_Days ) + dt2.ds_Minute;
time_diff = total_mins1 - total_mins2;
/*
* Convert diff minutes to days/hours/minutes diff
*/
*days = time_diff / 1440;
time_diff = time_diff - ( 1440 * (*days) );
*hours = time_diff / 60;
*mins = time_diff - ( 60 * (*hours) );
return;
} /* end function DateDiff */
/*========================================================================*
END FUNCTION DateDiff
*========================================================================*/